/**
 * User: alesj
 * Date: 2005.6.6
 * Time: 11:46:07
 * 
 * (C) Genera Lynx d.o.o.
 */

package com.alesj.newsfeed.web.object;

public class SelectSend {

    private String type;
    private int[] entry;
    private int[] exclude;
    private String query;

    private String confirm;
    private String subject;
    private String content;
    private int[] contact;
    private String[] emails;

    public boolean isPrepare() {
        return (confirm == null || !"confirm".equalsIgnoreCase(confirm));
    }

    public boolean hasQuery() {
        return (query != null && query.length() > 0);
    }

    public String getEmail(int contactId) {
        String start = contactId + "__";
        if (emails != null) {
            for(int i = 0; i < emails.length; i++) {
                if (emails[i].startsWith(start)) {
                    return emails[i].substring(start.length()); 
                }
            }
        }
        return null;
    }

    public String getType() {
        return type;
    }

    public void setType(String type) {
        this.type = type;
    }

    public int[] getEntry() {
        return entry;
    }

    public void setEntry(int[] entry) {
        this.entry = entry;
    }

    public int[] getExclude() {
        return exclude;
    }

    public void setExclude(int[] exclude) {
        this.exclude = exclude;
    }

    public String getQuery() {
        return query;
    }

    public void setQuery(String query) {
        this.query = query;
    }

    public String getConfirm() {
        return confirm;
    }

    public void setConfirm(String confirm) {
        this.confirm = confirm;
    }

    public String getSubject() {
        return subject;
    }

    public void setSubject(String subject) {
        this.subject = subject;
    }

    public String getContent() {
        return content;
    }

    public void setContent(String content) {
        this.content = content;
    }

    public int[] getContact() {
        return contact;
    }

    public void setContact(int[] contact) {
        this.contact = contact;
    }

    public String[] getEmails() {
        return emails;
    }

    public void setEmails(String[] emails) {
        this.emails = emails;
    }
}
